perm filename BIB.SAI[USE,CSR] blob sn#654841 filedate 1982-04-25 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	begin "bib"
C00006 ENDMK
C⊗;
begin "bib"

comment This program will process the bibliography file, one report at a
time.  For each report, it will prompt the user for the categories
available (i.e., hardcopy & fiche), and the price.  It will write
the entry for the report into a new file, with the new information
added.

comment The entries in the bibliography file are assumed to be separated
by blank (empty) lines.  Also, a check is made for lines beginning with
"@" (which are assumed to be SCRIBE commands), or "." (leftover PUB
commands);

require "⊂⊃" delimiters;
define crlf = ⊂('15&'12)⊃;
define icr = ⊂'15⊃;
define iff = ⊂'14⊃;

integer ichan, ochan, bfflf, blf, eof, brchar, flg, bff;
string ff, lf, line, entry, newentry, resp, help;

ff←'14; lf←'12;

eof←0;
open(ichan←getchan,"DSK",0,19,0,450,brchar,eof);
open(ochan←getchan,"DSK",0,0,19,0,0,eof);

lookup(ichan,"BIB.MSS", flg);
enter(ochan, "BIB.OUT", flg);

setbreak(bfflf←getbreak,ff&lf,null,"IA");
setbreak(blf←getbreak,lf,null,"IA");
setbreak(bff←getbreak,ff,null,"IA");

line←input(ichan,bfflf);

comment If there's a directory page, just step over it;
if equ(line[1 to 9], "COMMENT ⊗") then begin
    while brchar≠iff do line←input(ichan,bff);
    line←input(ichan,bfflf);
end;

comment Step over page 2, which contains various text;
while brchar≠iff do line←input(ichan,bff);
line←input(ichan,bfflf);

while ¬eof do begin "one entry"

    while line ≠icr ∧ brchar≠iff do begin "one line"
	entry←entry&line;
	line←input(ichan,bfflf);
    end "one line";

    entry←entry&line;

    comment now ENTRY contains the title, etc., for a single report;

    if entry≠"@" ∧ entry≠"." then begin "process entry"

	print(entry);
	print("What is the status of this report?");
	resp←inchwl;
	if resp="?" then print(help) 
	else newentry←resp&entry;
	comment will eventually put a loop in here;

	print("What is the price?    $");
	resp←inchwl;
	comment For now, there's no checking;
	newentry←newentry[1 to ∞-2]&resp&newentry[∞-1 for 2];

	out(ochan, newentry);
    end "process entry"
    else out(ochan, entry);

    line←input(ichan,bfflf);
    entry←"";

end "one entry";

close(ichan); close(ochan);

end "bib";